<template>
  <el-form ref="form" :model="data" label-width="100px" inline>
    <el-form-item label="姓名">
      <el-input
          placeholder="请输入姓名"
          v-model="data.name"
      ></el-input>
    </el-form-item>
    <el-form-item label="年龄">
      <el-input
          placeholder="请输入年龄"
          v-model.number="data.age"
      ></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-select v-model="data.sex">
        <el-option label="男" :value="0"></el-option>
        <el-option label="女" :value="1"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="出生日期">
      <el-date-picker
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期"
          v-model="data.birth"
      ></el-date-picker>
    </el-form-item>
    <el-form-item label="地址">
      <el-input
          placeholder="请输入地址"
          v-model.number="data.addr"
      ></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: "AUForm",
  computed: {
    data: {
      get() {
        return this.$store.state.addOrUpdate.data
      },
      set(val) {
        this.$store.commit('addOrUpdate/setData', val)
      }
    }
  },
}
</script>

<style scoped>

</style>
